<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
  <meta name="generator" content=
  "HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org">

  <title>bool</title>
  <link href="../cppreference.css" rel="stylesheet" type="text/css">
</head>

<body>
<table>
  <tr>
  <td>
  <div class="body-content">

  <div class="header-box">
    <a href="../index.html">cppreference.com</a> &gt; <a href=
    "index.html">C/C++ Keywords</a> &gt; <a href="bool.html">bool</a>
  </div>

  <div class="name-format">
    bool
  </div>

  <p>The keyword bool is used to declare Boolean logic variables; that
  is, variables which can be either true or false.</p>

  <p>For example, the following code declares a boolean variable called
  <em>done</em>, initializes it to false, and then loops until that
  variable is set to true.</p>
  <pre class="example-code">
   bool done = false;
   while( !done ) {
   ...
   }            
</pre>

  <p>Also see the <a href="../data_types.html">data types</a> page.</p>

  <div class="related-name-format">
    Related topics:
  </div>

  <div class="related-content">
    <a href="char.html">char</a><br>
    <a href="double.html">double</a><br>
    <a href="false.html">false</a><br>
    <a href="float.html">float</a><br>
    <a href="int.html">int</a><br>
    <a href="long.html">long</a><br>
    <a href="short.html">short</a><br>
    <a href="signed.html">signed</a><br>
    <a href="true.html">true</a><br>
    <a href="unsigned.html">unsigned</a><br>
    <a href="wchar_t.html">wchar_t</a>
  </div>
  </div>
  </td>
  


  </tr>
  </table>
</body></html>
